<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page session="false"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<head>
<title>Insert title here</title>
</head>
<body>
	<h3>Contacts</h3>
	<c:if test="${!empty contactList}">
		<table class="data">
			<tr>
				<th>Name</th>
				<th>Last Name</th>
				<th>Telephone</th>
				<th>Model</th>
				<th>Make</th>
				<th>&nbsp;</th>
			</tr>
			<c:forEach items="${contactList}" var="contact">
				<tr>
					<td>${contact.firstName }</td>
					<td>${contact.lastName }</td>
					<td>${contact.telephone}</td>
					<c:if test="${!empty contactList}">
						<c:forEach items="${contact.cars}" var="car">
							<td>${car.model}</td>
							<td>${car.make}</td>
						</c:forEach>
					</c:if>
					<td><a href="delete/${contact.id}">delete</a></td>
					<td><a href="edit/${contact.id}">edit</a></td>
				</tr>
			</c:forEach>
		</table>
	</c:if>
	<a href="add">go to add contact</a>
</body>
</html>